package com.grgbanking.it.system.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;

import com.grgbanking.it.common.json.JSONHelper;

/**
 * User entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user", catalog = "td_oa", uniqueConstraints = @UniqueConstraint(columnNames = "USER_ID"))
public class User implements java.io.Serializable {

	// Fields

	private Integer uid;
	private String userId;
	private String userName;
	private String userNameIndex;
	private String byname;
	private String useingKey;
	private String usingFinger;
	private String password;
	private String keySn;
	private String secureKeySn;
	private Integer userPriv;
	private Short userPrivNo;
	private String userPrivName;
	private String postPriv;
	private String postDept;
	private String postDesc;
	private Integer deptId;
	private String deptIdOther;
	private String sex;
	private String isLunar;
	private String telNoDept;
	private String faxNoDept;
	private String addHome;
	private String postNoHome;
	private String telNoHome;
	private String mobilNo;
	private String bpNo;
	private String email;
	private String oicqNo;
	private String icqNo;
	private String msn;
	private String avatar;
	private String callSound;
	private String smsOn;
	private String menuType;
	private Short theme;
	private String shortcut;
	private String portal;
	private String panel;
	private Integer online;
	private String onStatus;
	private String attendStatus;
	private String userDefine;
	private String mobilNoHidden;
	private String mytableLeft;
	private String mytableRight;
	private String userPrivOther;
	private Short userNo;
	private String notLogin;
	private String notViewUser;
	private String notViewTable;
	private String notSearch;
	private String bkground;
	private String bindIp;
	private String lastVisitIp;
	private String menuImage;
	private String weatherCity;
	private String showRss;
	private String myRss;
	private String remark;
	private String menuExpand;
	private String myStatus;
	private String limitLogin;
	private String lastVisitStr;
	private Short imRange;
	private String photo;
	private Integer secretLevel;
	private List<Role> roles; //权限，不保存数据库
	private List<Resource> resources;
	private Department department; 
	private Authority authority;

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "UID", unique = true, nullable = false)
	public Integer getUid() {
		return this.uid;
	}

	public void setUid(Integer uid) {
		this.uid = uid;
	}

	@Column(name = "USER_ID", unique = true, nullable = false, length = 40)
	public String getUserId() {
		return this.userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@Column(name = "USER_NAME", nullable = false, length = 60)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "USER_NAME_INDEX", nullable = false, length = 60)
	public String getUserNameIndex() {
		return this.userNameIndex;
	}

	public void setUserNameIndex(String userNameIndex) {
		this.userNameIndex = userNameIndex;
	}

	@Column(name = "BYNAME", nullable = false, length = 20)
	public String getByname() {
		return this.byname;
	}

	public void setByname(String byname) {
		this.byname = byname;
	}

	@Column(name = "USEING_KEY", nullable = false, length = 1)
	public String getUseingKey() {
		return this.useingKey;
	}

	public void setUseingKey(String useingKey) {
		this.useingKey = useingKey;
	}

	@Column(name = "USING_FINGER", nullable = false, length = 1)
	public String getUsingFinger() {
		return this.usingFinger;
	}

	public void setUsingFinger(String usingFinger) {
		this.usingFinger = usingFinger;
	}

	@Column(name = "PASSWORD", nullable = false, length = 50)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "KEY_SN", nullable = false, length = 20)
	public String getKeySn() {
		return this.keySn;
	}

	public void setKeySn(String keySn) {
		this.keySn = keySn;
	}

	@Column(name = "SECURE_KEY_SN", nullable = false, length = 20)
	public String getSecureKeySn() {
		return this.secureKeySn;
	}

	public void setSecureKeySn(String secureKeySn) {
		this.secureKeySn = secureKeySn;
	}

	@Column(name = "USER_PRIV", nullable = false)
	public Integer getUserPriv() {
		return this.userPriv;
	}

	public void setUserPriv(Integer userPriv) {
		this.userPriv = userPriv;
	}

	@Column(name = "USER_PRIV_NO", nullable = false)
	public Short getUserPrivNo() {
		return this.userPrivNo;
	}

	public void setUserPrivNo(Short userPrivNo) {
		this.userPrivNo = userPrivNo;
	}

	@Column(name = "USER_PRIV_NAME", nullable = false, length = 40)
	public String getUserPrivName() {
		return this.userPrivName;
	}

	public void setUserPrivName(String userPrivName) {
		this.userPrivName = userPrivName;
	}

	@Column(name = "POST_PRIV", nullable = false, length = 1)
	public String getPostPriv() {
		return this.postPriv;
	}

	public void setPostPriv(String postPriv) {
		this.postPriv = postPriv;
	}

	@Column(name = "POST_DEPT", nullable = false, length = 1000)
	public String getPostDept() {
		return this.postDept;
	}

	public void setPostDept(String postDept) {
		this.postDept = postDept;
	}

	@Column(name = "POST_DESC", nullable = false, length = 65535)
	public String getPostDesc() {
		return this.postDesc;
	}

	public void setPostDesc(String postDesc) {
		this.postDesc = postDesc;
	}

	@Column(name = "DEPT_ID", nullable = false)
	public Integer getDeptId() {
		return this.deptId;
	}

	public void setDeptId(Integer deptId) {
		this.deptId = deptId;
	}

	@Column(name = "DEPT_ID_OTHER", nullable = false, length = 100)
	public String getDeptIdOther() {
		return this.deptIdOther;
	}

	public void setDeptIdOther(String deptIdOther) {
		this.deptIdOther = deptIdOther;
	}

	
	@Column(name = "SEX", nullable = false, length = 1)
	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}


	@Column(name = "IS_LUNAR", nullable = false, length = 1)
	public String getIsLunar() {
		return this.isLunar;
	}

	public void setIsLunar(String isLunar) {
		this.isLunar = isLunar;
	}

	@Column(name = "TEL_NO_DEPT", nullable = false, length = 50)
	public String getTelNoDept() {
		return this.telNoDept;
	}

	public void setTelNoDept(String telNoDept) {
		this.telNoDept = telNoDept;
	}

	@Column(name = "FAX_NO_DEPT", nullable = false, length = 50)
	public String getFaxNoDept() {
		return this.faxNoDept;
	}

	public void setFaxNoDept(String faxNoDept) {
		this.faxNoDept = faxNoDept;
	}

	@Column(name = "ADD_HOME", nullable = false, length = 200)
	public String getAddHome() {
		return this.addHome;
	}

	public void setAddHome(String addHome) {
		this.addHome = addHome;
	}

	@Column(name = "POST_NO_HOME", nullable = false, length = 50)
	public String getPostNoHome() {
		return this.postNoHome;
	}

	public void setPostNoHome(String postNoHome) {
		this.postNoHome = postNoHome;
	}

	@Column(name = "TEL_NO_HOME", nullable = false, length = 50)
	public String getTelNoHome() {
		return this.telNoHome;
	}

	public void setTelNoHome(String telNoHome) {
		this.telNoHome = telNoHome;
	}

	@Column(name = "MOBIL_NO", nullable = false, length = 50)
	public String getMobilNo() {
		return this.mobilNo;
	}

	public void setMobilNo(String mobilNo) {
		this.mobilNo = mobilNo;
	}

	@Column(name = "BP_NO", nullable = false, length = 50)
	public String getBpNo() {
		return this.bpNo;
	}

	public void setBpNo(String bpNo) {
		this.bpNo = bpNo;
	}

	@Column(name = "EMAIL", nullable = false, length = 50)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "OICQ_NO", nullable = false, length = 50)
	public String getOicqNo() {
		return this.oicqNo;
	}

	public void setOicqNo(String oicqNo) {
		this.oicqNo = oicqNo;
	}

	@Column(name = "ICQ_NO", nullable = false, length = 50)
	public String getIcqNo() {
		return this.icqNo;
	}

	public void setIcqNo(String icqNo) {
		this.icqNo = icqNo;
	}

	@Column(name = "MSN", nullable = false, length = 200)
	public String getMsn() {
		return this.msn;
	}

	public void setMsn(String msn) {
		this.msn = msn;
	}

	@Column(name = "AVATAR", nullable = false, length = 20)
	public String getAvatar() {
		return this.avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	@Column(name = "CALL_SOUND", nullable = false, length = 1)
	public String getCallSound() {
		return this.callSound;
	}

	public void setCallSound(String callSound) {
		this.callSound = callSound;
	}


	@Column(name = "SMS_ON", nullable = false, length = 1)
	public String getSmsOn() {
		return this.smsOn;
	}

	public void setSmsOn(String smsOn) {
		this.smsOn = smsOn;
	}

	@Column(name = "MENU_TYPE", nullable = false, length = 1)
	public String getMenuType() {
		return this.menuType;
	}

	public void setMenuType(String menuType) {
		this.menuType = menuType;
	}

	
	@Column(name = "THEME", nullable = false)
	public Short getTheme() {
		return this.theme;
	}

	public void setTheme(Short theme) {
		this.theme = theme;
	}

	@Column(name = "SHORTCUT", nullable = false, length = 100)
	public String getShortcut() {
		return this.shortcut;
	}

	public void setShortcut(String shortcut) {
		this.shortcut = shortcut;
	}

	@Column(name = "PORTAL", nullable = false, length = 20)
	public String getPortal() {
		return this.portal;
	}

	public void setPortal(String portal) {
		this.portal = portal;
	}

	@Column(name = "PANEL", nullable = false, length = 1)
	public String getPanel() {
		return this.panel;
	}

	public void setPanel(String panel) {
		this.panel = panel;
	}

	@Column(name = "ONLINE", nullable = false)
	public Integer getOnline() {
		return this.online;
	}

	public void setOnline(Integer online) {
		this.online = online;
	}

	@Column(name = "ON_STATUS", nullable = false, length = 1)
	public String getOnStatus() {
		return this.onStatus;
	}

	public void setOnStatus(String onStatus) {
		this.onStatus = onStatus;
	}

	@Column(name = "ATTEND_STATUS", nullable = false, length = 1)
	public String getAttendStatus() {
		return this.attendStatus;
	}

	public void setAttendStatus(String attendStatus) {
		this.attendStatus = attendStatus;
	}

	@Column(name = "USER_DEFINE", nullable = false, length = 65535)
	public String getUserDefine() {
		return this.userDefine;
	}

	public void setUserDefine(String userDefine) {
		this.userDefine = userDefine;
	}

	@Column(name = "MOBIL_NO_HIDDEN", nullable = false, length = 1)
	public String getMobilNoHidden() {
		return this.mobilNoHidden;
	}

	public void setMobilNoHidden(String mobilNoHidden) {
		this.mobilNoHidden = mobilNoHidden;
	}

	@Column(name = "MYTABLE_LEFT", nullable = false, length = 200)
	public String getMytableLeft() {
		return this.mytableLeft;
	}

	public void setMytableLeft(String mytableLeft) {
		this.mytableLeft = mytableLeft;
	}

	@Column(name = "MYTABLE_RIGHT", nullable = false, length = 200)
	public String getMytableRight() {
		return this.mytableRight;
	}

	public void setMytableRight(String mytableRight) {
		this.mytableRight = mytableRight;
	}

	@Column(name = "USER_PRIV_OTHER", nullable = false, length = 100)
	public String getUserPrivOther() {
		return this.userPrivOther;
	}

	public void setUserPrivOther(String userPrivOther) {
		this.userPrivOther = userPrivOther;
	}

	@Column(name = "USER_NO", nullable = false)
	public Short getUserNo() {
		return this.userNo;
	}

	public void setUserNo(Short userNo) {
		this.userNo = userNo;
	}

	@Column(name = "NOT_LOGIN", nullable = false, length = 1)
	public String getNotLogin() {
		return this.notLogin;
	}

	public void setNotLogin(String notLogin) {
		this.notLogin = notLogin;
	}

	@Column(name = "NOT_VIEW_USER", nullable = false, length = 1)
	public String getNotViewUser() {
		return this.notViewUser;
	}

	public void setNotViewUser(String notViewUser) {
		this.notViewUser = notViewUser;
	}

	@Column(name = "NOT_VIEW_TABLE", nullable = false, length = 1)
	public String getNotViewTable() {
		return this.notViewTable;
	}

	public void setNotViewTable(String notViewTable) {
		this.notViewTable = notViewTable;
	}

	@Column(name = "NOT_SEARCH", nullable = false, length = 1)
	public String getNotSearch() {
		return this.notSearch;
	}

	public void setNotSearch(String notSearch) {
		this.notSearch = notSearch;
	}

	@Column(name = "BKGROUND", nullable = false, length = 200)
	public String getBkground() {
		return this.bkground;
	}

	public void setBkground(String bkground) {
		this.bkground = bkground;
	}

	@Column(name = "BIND_IP", nullable = false, length = 200)
	public String getBindIp() {
		return this.bindIp;
	}

	public void setBindIp(String bindIp) {
		this.bindIp = bindIp;
	}

	@Column(name = "LAST_VISIT_IP", nullable = false, length = 20)
	public String getLastVisitIp() {
		return this.lastVisitIp;
	}

	public void setLastVisitIp(String lastVisitIp) {
		this.lastVisitIp = lastVisitIp;
	}

	@Column(name = "MENU_IMAGE", nullable = false, length = 10)
	public String getMenuImage() {
		return this.menuImage;
	}

	public void setMenuImage(String menuImage) {
		this.menuImage = menuImage;
	}

	@Column(name = "WEATHER_CITY", nullable = false, length = 10)
	public String getWeatherCity() {
		return this.weatherCity;
	}

	public void setWeatherCity(String weatherCity) {
		this.weatherCity = weatherCity;
	}

	@Column(name = "SHOW_RSS", nullable = false, length = 1)
	public String getShowRss() {
		return this.showRss;
	}

	public void setShowRss(String showRss) {
		this.showRss = showRss;
	}

	@Column(name = "MY_RSS", nullable = false, length = 65535)
	public String getMyRss() {
		return this.myRss;
	}

	public void setMyRss(String myRss) {
		this.myRss = myRss;
	}

	@Column(name = "REMARK", nullable = false, length = 65535)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "MENU_EXPAND", nullable = false, length = 2)
	public String getMenuExpand() {
		return this.menuExpand;
	}

	public void setMenuExpand(String menuExpand) {
		this.menuExpand = menuExpand;
	}

	@Column(name = "MY_STATUS", nullable = false, length = 200)
	public String getMyStatus() {
		return this.myStatus;
	}

	public void setMyStatus(String myStatus) {
		this.myStatus = myStatus;
	}

	@Column(name = "LIMIT_LOGIN", nullable = false, length = 1)
	public String getLimitLogin() {
		return this.limitLogin;
	}

	public void setLimitLogin(String limitLogin) {
		this.limitLogin = limitLogin;
	}

	

	@Column(name = "LAST_VISIT_STR", nullable = false, length = 100)
	public String getLastVisitStr() {
		return this.lastVisitStr;
	}

	public void setLastVisitStr(String lastVisitStr) {
		this.lastVisitStr = lastVisitStr;
	}

	@Column(name = "IM_RANGE", nullable = false)
	public Short getImRange() {
		return this.imRange;
	}

	public void setImRange(Short imRange) {
		this.imRange = imRange;
	}

	@Column(name = "PHOTO", nullable = false, length = 20)
	public String getPhoto() {
		return this.photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	@Column(name = "SECRET_LEVEL", nullable = false)
	public Integer getSecretLevel() {
		return this.secretLevel;
	}

	public void setSecretLevel(Integer secretLevel) {
		this.secretLevel = secretLevel;
	}

	@Transient 
	public List<Role> getRoles() {
		return roles;
	}

	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}

	@Transient 
	public Department getDepartment() {
		return department;
	}

	public void setDepartment(Department department) {
		this.department = department;
	}
	
	@Transient
	public List<Resource> getResources() {
		return resources;
	}

	public void setResources(List<Resource> resources) {
		this.resources = resources;
	}

	/**
	 * 获取资源串
	 * getResourceData
	 * 
	 * @return 
	 * @exception 
	 * @since  1.0.0
	 */
	@Transient
	public String getResourceData(){
		return JSONHelper.converList(resources);
	}

	/**
	 * 获取权限
	 * getAuthority
	 * 
	 * @return 
	 * @exception 
	 * @since  1.0.0
	 */
	@Transient
	public Authority getAuthority() {
		if(authority == null){
			authority = new Authority(this);
		}
		return authority;
	}

	
	
	
}